[Mysql] ERROR 1805 (HY000): Column count of mysql.user is wrong. Expected 45, found 43. The table is probably corrupted


本文总阅读量

1、从mysql5.6 msyqldump全备出来数据,导入到mysql5.7的库,导入导出均正常,在5.7的库新增用户时,提示以下错误:

1
2
root@db 09:21:  [(none)]> grant select,update,delete,insert on *.* to 'clevergo'@'%' identified by '123123';
ERROR 1805 (HY000): Column count of mysql.user is wrong. Expected 45, found 43. The table is probably corrupted

2、造成该问题是因为把5.6的库数据,全部导入5.7造成的,因此需要使用mysql_upgrade将库升级到最新版本:

/data/mysql/bin/mysql_upgrade -uroot -p123456

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
mysql_upgrade: [Warning] Using a password on the command line interface can be insecure.
Checking if update is needed.
Checking server version.
Running queries to upgrade MySQL server.
Checking system database.
mysql.columns_priv OK
mysql.db OK
mysql.engine_cost OK
mysql.event OK
mysql.func OK
mysql.general_log OK
mysql.gtid_executed OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.innodb_index_stats OK
mysql.innodb_table_stats OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxies_priv OK
mysql.server_cost OK
mysql.servers OK
mysql.slave_master_info OK
mysql.slave_relay_log_info OK
mysql.slave_worker_info OK
mysql.slow_log OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
The sys schema is already up to date (version 1.5.1).
Found 0 sys functions, but expected 22. Re-installing the sys schema.
Upgrading the sys schema.
Checking databases.
t.t_test OK
Upgrade process completed successfully.
Checking if update is needed.

3、进入mysql,再次执行创建用户:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
root@db 09:26:  [(none)]> grant select,update,delete,insert on *.* to 'clevergo'@'%' identified by '123123';
Query OK, 0 rows affected, 1 warning (0.01 sec)

root@db 09:26: [(none)]> flush privileges;
Query OK, 0 rows affected (0.01 sec)

root@db 09:26: [(none)]> select host,user from mysql.user;
+-----------+----------------+
| host | user |
+-----------+----------------+
| % | clevergo |
| localhost | mysql.session |
| localhost | mysql.sys |
| localhost | root |
+-----------+----------------+
6 rows in set (0.00 sec)

root@db 09:26: [(none)]> exit
Bye

执行成功。

目录
  1. 1. 1、从mysql5.6 msyqldump全备出来数据,导入到mysql5.7的库,导入导出均正常,在5.7的库新增用户时,提示以下错误:
  2. 2. 2、造成该问题是因为把5.6的库数据,全部导入5.7造成的,因此需要使用mysql_upgrade将库升级到最新版本:
  3. 3. 3、进入mysql,再次执行创建用户:

Proudly powered by Hexo and Theme by Lap
本站访客数人次
© 2020 zeven0707's blog